package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.factory.RemoteAiFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * AI智能助手服务
 * 
 * @author ruoyi
 */
@FeignClient(contextId = "remoteAiService", value = ServiceNameConstants.LDZL_AI_SERVICE, fallbackFactory = RemoteAiFallbackFactory.class)
public interface RemoteAiService
{
    /**
     * AI对话接口
     *
     * @param prompt 用户输入
     * @param chatId 会话ID
     * @param source 请求来源
     * @return AI响应结果
     */
    @GetMapping("/ai/service")
    public R<String> chat(@RequestParam("prompt") String prompt, 
                         @RequestParam(value = "chatId", required = false) String chatId,
                         @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * AI服务健康检查
     *
     * @param source 请求来源
     * @return 健康状态
     */
    @GetMapping("/ai/test")
    public R<String> healthCheck(@RequestParam(value = "message", required = false) String message,
                                @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
